<div class="fm-content">
  <div class="title">
    <i nz-icon [type]="'desktop'"></i>
    &nbsp;&nbsp;检查配置
  </div>
  <div class="clwork">
    <div class="top">
      <input nz-input placeholder="检查名称" class="fm-input first-input" [(ngModel)]="fs.queryObject['name:like']" />
      <input nz-input placeholder="环节名称" class="fm-input" [(ngModel)]="fs.queryObject['tachename:like']" />
      <nz-select class="fm-input" [(ngModel)]="fs.queryObject['type']" (nzOpenChange)="typeDic.load('0')"
        [nzPlaceHolder]="'类型'">
        <nz-option *ngFor="let option of typeDic.datas" [nzLabel]="option.display" [nzValue]="option.id">
        </nz-option>
        <nz-option *ngIf="typeDic.isLoading" nzDisabled nzCustomContent>
          <i nz-icon type="loading" class="loading-icon"></i>加载中...
        </nz-option>
      </nz-select>
      <nz-button-group class="fm-search-input">
        <button nz-button nzType="primary" (click)="fs.loadData(true)">查询</button>
        <button nz-button (click)="fs.resetQueryObject() && fs.loadData(true)">重置</button>
      </nz-button-group>
      <div class="tool-right">
        <nz-button-group>
          <button nz-button [nzType]="'primary'" (click)="fs.addRow()">新增</button>
          <button nz-button (click)="fs.editRow()">编辑</button>
          <button nz-popconfirm nzTitle="确认删除选择项?" (nzOnConfirm)="fs.delEntitys()" nzPlacement="bottomRight"
            nz-button>删除</button>
        </nz-button-group>
      </div>
    </div>

    <div class="left top-left">
      <div style="margin-top:5px; margin-left: 21px;">
        <nz-tree [nzShowExpand]='false' (nzClick)="fs.loadDataEx($event.node.key)"
          [nzData]="sideDic.treeDatas">
        </nz-tree>
      </div>
    </div>

    <div class="right top-right">
      <div class="table">
        <nz-table nzSize="middle" nzShowSizeChanger [nzPageSizeOptions]='[ 10, 15, 20, 30, 40, 50 ]'
          [nzFrontPagination]="false" [nzData]="fs.datas" [nzLoading]="fs.isLoading || fs.isDeleing"
          [nzTotal]="fs.rowsCount" [(nzPageIndex)]="fs.pageIndex" [(nzPageSize)]="fs.pageSize"
          (nzPageIndexChange)="fs.loadData()" (nzPageSizeChange)="fs.loadData(true)">
          <thead>
            <tr>
              <th nzWidth="5%" nzShowCheckbox [(nzChecked)]="fs.allChecked" [nzIndeterminate]="fs.indeterminate"
                (nzCheckedChange)="fs.checkAll($event)"></th>
              <th nzWidth="60%">检查名称</th>
              <th nzWidth="20%">环节名称</th>
              <th nzWidth="15%">类型</th>
            </tr>
          </thead>
          <tbody>
            <tr *ngFor="let data of fs.datas">
              <td nzShowCheckbox [(nzChecked)]="data.checked" (nzCheckedChange)="fs.refreshCheckStatus()">
              </td>
              <td><span (click)="fs.editRow(data)" class="form-edit">{{data.name}}</span></td>
              <td>{{data.tachename}}</td>
              <td>{{data.typeName}}</td>
            </tr>
          </tbody>
        </nz-table>
      </div>
    </div>

    <nz-modal nzWidth='830' nzTitle="编辑" [nzMaskClosable]='false' [nzFooter]="null" [(nzVisible)]="fs.isEditVisible"
      (nzOnCancel)="fs.closeEdit()">
      <form nz-form [nzLayout]="'inline'">
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">检查名称</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input [(ngModel)]="fs.er.name" name="name" required #name="ngModel" />
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">类型</nz-form-label>
              <nz-form-control class="form-control">
                <nz-select class="form-control" [(ngModel)]="fs.er.type" name="type" required #type="ngModel"
                  (nzOpenChange)="typeDic.load('0')" [nzPlaceHolder]="'请选择'">
                  <nz-option *ngFor="let option of typeDic.datas" [nzLabel]="option.display" [nzValue]="option.id">
                  </nz-option>
                  <nz-option *ngIf="typeDic.isLoading" nzDisabled nzCustomContent>
                    <i nz-icon type="loading" class="loading-icon"></i>加载中...
                  </nz-option>
                  <span *ngIf="!typeDic.isLoaded">
                    <nz-option [nzLabel]="fs.er.typeName" [nzValue]="fs.er.type">
                    </nz-option>
                  </span>
                </nz-select>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">环节名称</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input [(ngModel)]="fs.er.tachename" name="tachename" required #tachename="ngModel" />
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">环节索引</nz-form-label>
              <nz-form-control class="form-control">
                <nz-input-number [(ngModel)]="fs.er.tacheid" name="tacheid" required #tacheid="ngModel" [nzMin]="1"
                  [nzMax]="100" [nzStep]="1" class="form-control">
                </nz-input-number>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="24">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">检查规则</nz-form-label>
              <nz-form-control class="form-control3">
                <textarea nz-input [(ngModel)]="fs.er.rule" name="rule" required #rule="ngModel"
                  style="height: 110px;"></textarea>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="24">
            <nz-form-item>
              <nz-form-label class="form-label">规则说明</nz-form-label>
              <nz-form-control class="form-control3">
                <textarea nz-input [(ngModel)]="fs.er.ruledesc" name="ruledesc" required #ruledesc="ngModel"
                  style="height: 110px;"></textarea>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">bean名称</nz-form-label>
              <nz-form-control class="form-control">
                <input nz-input [(ngModel)]="fs.er.beanname" name="beanname" required #beanname="ngModel" />
              </nz-form-control>
            </nz-form-item>
          </div>
          <div nz-col [nzSpan]="12">
            <nz-form-item>
              <nz-form-label nzRequired class="form-label">排序号</nz-form-label>
              <nz-form-control class="form-control">
                <nz-input-number [(ngModel)]="fs.er.order" name="order" required #order="ngModel" [nzMin]="1"
                  [nzMax]="100" [nzStep]="1" class="form-control">
                </nz-input-number>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="24">
            <nz-form-item>
              <nz-form-label class="form-label">通用参数</nz-form-label>
              <nz-form-control class="form-control3">
                <textarea nz-input [(ngModel)]="fs.er.paras" name="paras" required #paras="ngModel"
                  style="height: 110px;"></textarea>
              </nz-form-control>
            </nz-form-item>
          </div>
        </div>
        <div nz-row [nzGutter]="24">
          <div nz-col [nzSpan]="24" class="form-button-align">
            <button nz-button nzType="default" (click)="fs.closeEdit()" class="form-button">取消</button>
            <button nz-button nzType="primary"
              [disabled]='name.invalid || type.invalid || tachename.invalid || tacheid.invalid || rule.invalid || beanname.invalid || order.invalid'
              (click)="fs.save()" [nzLoading]="fs.isSaveing">保存</button>
          </div>
        </div>
      </form>
    </nz-modal>
  </div>
</div>
